package com.chdwmp.product.mapper;

import com.chdwmp.product.bean.backend.*;
import com.chdwmp.product.bean.params.AgentListSearch;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Auther: LLL
 * @Date: 2021/5/9 09:10
 * @Description:
 */
@Mapper
public interface AgentMapper {

    void updateAgent(AgentVo agentVo);

    void insertAgent(AgentVo agentVo);

    void deleteAgent(String id);

    int queryTotalCount(AgentListSearch search);

    List<AgentVo> queryAgentList(AgentListSearch search);

    int queryAgentIsExits(@Param("agentName") String agentName, @Param("imei") String imei);

    void addAgentProductRealtion(@Param("productId") Integer productId, @Param("id")Integer id,@Param("count") int count);

    int queryTotalBuyCount(AgentListSearch search);

    List<AgentListVo> queryAgentBuyProducts(AgentListSearch search);

    List<AgentBuyProductVo> queryAgentBuyProduct(@Param("agentName") String agentName);

    AgentVo queryAgentInfoByImei(String imei);

    List<String> queryAgentBuyProductIds(String agentName);

    String queryAgentBuyProductTime(@Param("agentName") String agentName, @Param("imei")String imei);

    @Select("select count(*) from t_agents where imei = #{imei}")
    int queryImeiIsExits(String imei);

    @Select("select count(*) from t_agents where agent_name = #{agentName}")
    int queryAgentCount(String agentName);

    int queryAgentBuyProductCount(String agentName);

    int queryAgentBuyProdutCoutList(String agentName);

    void updateAgentGiveCount(@Param("id") Integer id, @Param("count")int count);

    int queryAgentStatisticCount(ProductAgentSearchVo productAgentSearchVo);

    List<ProductStatisticsVo> queryProductAgentStatisticList(ProductAgentSearchVo productAgentSearchVo);


    List<AgentBuyProductVo> queryAgentBuyList(ProductAgentSearchVo productAgentSearchVo);
}
